home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mac Magazin/MacEasy 32
/
Mac Magazin and MacEasy Magazine CD - Issue 32.iso
/
Multimedia
/
PlayerPRO 4.5.5 Dev.Kit
/
Plug-Ins
/
Music Import⁄Export Plugs
/
FileUtilsMac.c
< prev
next >
Wrap
C/C++ Source or Header
|
1997-02-25
|
2KB
|
110 lines
#include "FileUtils.h"
short iFileOpen( Ptr name)
{
short temp;
OSErr iErr;
c2pstr( name);
iErr = FSOpen( (unsigned char*) name, 0, &temp);
p2cstr( (unsigned char*) name);
if( iErr) return 0;
else return temp;
}
long iGetEOF( short iFileRefI)
{
long curEOF;
GetEOF( iFileRefI, &curEOF);
return curEOF;
}
OSErr iRead( long size, Ptr dest, short iFileRefI)
{
return FSRead( iFileRefI, &size, dest);
}
OSErr iSeekCur( long size, short iFileRefI)
{
return SetFPos( iFileRefI, fsFromMark, size);
}
void iFileCreate( Ptr name, long type)
{
c2pstr( name);
FSDelete( (unsigned char*)name, 0L);
Create( (unsigned char*) name, 0, 'SNPL', type);
p2cstr( (unsigned char*) name);
}
OSErr iWrite( long size, Ptr dest, short iFileRefI)
{
return FSWrite( iFileRefI, &size, dest);
}
void iClose( short iFileRefI)
{
FSClose( iFileRefI);
}
/////////////////////////////////
void MOT32( void *msg_buf)
{
}
void MOT16( void *msg_buf)
{
}
/////////////////////////////////
void INT32( void *msg_buf)
{
unsigned char *buf = msg_buf;
unsigned long out;
out = ( (unsigned long) buf[3] << 24) | ( (unsigned long) buf[2] << 16) | ( (unsigned long) buf[ 1] << 8) | ( (unsigned long) buf[0]);
*((unsigned long*) msg_buf) = out;
}
void INT16( void *msg_buf)
{
unsigned char *buf = msg_buf;
short out;
out = ( (short) buf[1] << 8) | ( (short) buf[0]);
*((short*) msg_buf) = out;
}
/////////////////////////////////
#ifndef __SHUDDUPH__
Ptr strcpy( Ptr dst, const char* src)
{
long i = 0;
do
{
dst[ i] = src[ i];
}while( src[ i++]);
return dst;
}
int strcmp( const char *dst, const char* src)
{
long i = 0;
do
{
if( dst[ i] != src[ i]) return -1;
}while( src[ i++]);
return 0;
}
#endif